//导航守卫组件
import React from "react";
import { Route } from "react-router-dom";

function AuthRouter({ component: Component, path, to }) {
  return (
    <Route
      path={path}
      render={(props) => {
        if (localStorage.getItem("geek_pc")) {
          return <Component {...props}></Component>;
        } else {
          return props.history.push(to);
        }
      }}
    ></Route>
  );
}

export default AuthRouter;
